//
//  SimpleFooterView.m
//  FMSManagerDemo
//
//  Created by hongbao.cui on 14-12-12.
//  Copyright (c) 2014年 hongbao.cui. All rights reserved.
//

#import "SimpleFooterView.h"

@implementation SimpleFooterView
@synthesize delegate;
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(void)textBtnClicked:(id)sender{
    if ([delegate respondsToSelector:@selector(SimpleFooterView:textBtnClicked:)]) {
        [delegate SimpleFooterView:self textBtnClicked:sender];
    }
}
-(void)picBtnClicked:(id)sender{
    if ([delegate respondsToSelector:@selector(SimpleFooterView:picBtnClicked:)]) {
        [delegate SimpleFooterView:self picBtnClicked:sender];
    }
}
-(void)draftBtnClicked:(id)sender{
    if ([delegate respondsToSelector:@selector(SimpleFooterView:draftBtnClicked:)]) {
        [delegate SimpleFooterView:self draftBtnClicked:sender];
    }
}
-(id)initWithFrame:(CGRect)frame{
    if (self == [super initWithFrame:frame]) {
        self.userInteractionEnabled = YES;
        self.backgroundColor = [UIColor lightGrayColor];
        CGRect rect = [UIScreen mainScreen].bounds;
        int offSet = (rect.size.width-45*3)/4;
        UIButton *textBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [textBtn setFrame:CGRectMake(offSet, 10, 45.0, 30)];
        [textBtn setTitle:@"文本" forState:UIControlStateNormal];
        [textBtn setTitle:@"文本" forState:UIControlStateHighlighted];
        [textBtn addTarget:self action:@selector(textBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:textBtn];
        
        UIButton *picBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [picBtn setFrame:CGRectMake(45+offSet*2, 10, 45.0, 30)];
        [picBtn setTitle:@"拍照" forState:UIControlStateNormal];
        [picBtn setTitle:@"拍照" forState:UIControlStateHighlighted];
        [picBtn addTarget:self action:@selector(picBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:picBtn];
        
        UIButton *draftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [draftBtn setFrame:CGRectMake((45+offSet)*2+offSet, 10, 45.0, 30)];
        [draftBtn setTitle:@"涂鸦" forState:UIControlStateNormal];
        [draftBtn setTitle:@"涂鸦" forState:UIControlStateHighlighted];
        [draftBtn addTarget:self action:@selector(draftBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:draftBtn];
    }
    return self;
}
@end
